Skip to content

Fix hover on method parameters with inline RBS annotations#369

Merged
mame merged 3 commits intoruby:masterfrom
whtsht:inline-hover
Feb 17, 2026
Merged

Fix hover on method parameters with inline RBS annotations#369
mame merged 3 commits intoruby:masterfrom
whtsht:inline-hover

Conversation

@whtsht
Copy link
Contributor

@whtsht whtsht commented Feb 16, 2026

There was an issue where hovering was not possible when method arguments had rbs comments.

The root cause was an off-by-one error: Prism::Location#start_line is 1-based, but rbs_comments is indexed by 0-based line numbers.
As a result, the first element of rbs_comments ended up being nil, e.g.:

[nil, " (Integer) -> void"]

whtsht@0e6baab

This PR fixes the issue by subtracting 1 from start_line before indexing/storing into rbs_comments.

@whtsht
Copy link
Contributor Author

whtsht commented Feb 16, 2026

screenshot :)

before
image

after
image

Copy link
Member

@mame mame left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much!

@mame mame merged commit ef0935b into ruby:master Feb 17, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants